package com.example.hangzhou.welbeing.mytestdemoapp.designPatterns.CreatorModel;

import com.example.hangzhou.welbeing.mytestdemoapp.designPatterns.CreatorModel.inter.Item;

import java.util.ArrayList;
import java.util.List;

/**
 * 杭州惟君医疗科技有限公司10
 * Created by 20433 on 2018/5/17
 *
 * @desc 东风山河绿，春已不折柳，繁花看不尽，处处惹人留
 * @desc 佛祖镇楼，bug辟容易
 */

public class Meal {
    private List<Item> items = new ArrayList<Item>();
    public void addItem(Item item){
        items.add(item);
    }
    public float getCost(){
        float cost = 0.0f;
        for (Item item : items) {
            cost += item.price();
        }
        return cost;
    }
    public void showItems(){
        for (Item item : items) {
            System.out.print("Item : "+item.name());
            System.out.print(", Packing : "+item.packing().pack());
            System.out.println(", Price : "+item.price());
        }
    }


}
